package utiles;

public final class Numeros {
	
	private Numeros(){}
	
	/**
	 * 
	 * @param numbero
	 * @param posiciones
	 * @return
	 */
	public static double redondear(double numbero, int posiciones){
		int pot= (int) Math.pow(10, posiciones);
		numbero = Math.round(numbero * pot);
		return numbero/pot;
	}
	
	public static int randomInteger(int min, int max){
		return (int)randomDouble(min, max);
	}
	
	public static double randomDouble(int min, int max){
		return Math.random()*(max-min+1)+min;
	}
	
	public static void main(String[] args) {
		Double v, vr;
		for(int i= 0; i < 20; i++){
			v= randomDouble(0,20);
			vr= redondear(v,4);
			System.out.println(v+" // "+vr);		
		}
	}
}
